import request from "./request";

//获取全部图书
export function bookAll() {
  return request.get('/find_all_book');
}
//分页查询图书
export function findBookByLimit(pageNum,limit) {
  return request.get('find_book_by_limit',{
    params:{
      pageNum,
      limit
    }
  })
}
//添加图书
export function addBook(bookObj) {
  console.log(bookObj)
  return request.post('add_book',{
    name:bookObj.name,
    author:bookObj.author,
    cover:bookObj.cover,
    price:parseFloat(bookObj.price),
    press:bookObj.press,
    // imageList:bookObj.imageList,
    info:bookObj.info,
  })
}
// 根据isbn删除图书
export function deleteBookByIsbn(isbn){
  return request.delete(`delete_book?isbn=${isbn}`);
}
// 根据isbn查询书籍详情
export function getBookByIsbn(isbn){
  return request.get(`find_book_by_isbn?isbn=${isbn}`)
}
//根据isbn更新书籍
export function updateBookByIsbn(bookObj) {
  return request.post('update_book',{
    isbn:bookObj.isbn,
    name:bookObj.name,
    author:bookObj.author,
    cover:bookObj.cover,
    price:bookObj.price,
    press:bookObj.press,
    // imageList:bookObj.imageList,
    info:bookObj.info,
  })
}






